﻿using Abp.Domain.Entities.Auditing;
using FutureApp.Users;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace FutureApp.Shop
{
    /// <summary>
    /// 商品分类基础属性组合
    /// </summary>
    [Table("GoodsCategoryAssembles")]
    public class GoodsCategoryAssemble : CreationAuditedEntity<Guid, User>
    {
        /// <summary>
        /// 商品分类Id
        /// </summary>
        [Required]
        public virtual Guid CategoryId { get; set; }

        /// <summary>
        /// 商品分类
        /// </summary>
        [ForeignKey(nameof(CategoryId))]
        public virtual GoodsCategory Category { get; set; }

        /// <summary>
        /// 商品基本属性Id
        /// </summary>
        [Required]
        public virtual Guid PropertyId { get; set; }

        /// <summary>
        /// 商品基本属性
        /// </summary>
        [ForeignKey(nameof(PropertyId))]
        public virtual GoodsProperty Property { get; set; }

        /// <summary>
        /// 商品基本属性别名
        /// </summary>
        [StringLength(GoodsProperty.MaxNameLength)]
        public string PropertyAlias { get; set; }

        /// <summary>
        /// 排序号
        /// </summary>
        [Required]
        public virtual int Order { get; set; } = 0;
    }
}
